/**
 * @author yan
 * @date 2025/7/29
 */
public class charupaixu {
    static class solution {
        public int[] charuSort(int[] arr) {
            int n = arr.length;
            for(int i=1;i<n;i++){
                int key = arr[i];
                int j = i-1;
                while(j>=0 && arr[j]>key){
                    arr[j+1] = arr[j];
                    j--;
                }
                arr[j+1] = key;
            }
            return arr;
        }

    }
    public static void main(String[] args) {
        solution s = new solution();
        int[] arr = {5,2,3,4,8,9};
        for (int i:s.charuSort(arr))
            System.out.print(i+" ");
    }
}
